package edu.langnan.xiaoli.service.impl;

import edu.langnan.xiaoli.core.domain.CollegeDO;
import edu.langnan.xiaoli.mapper.CollegeMapper;
import edu.langnan.xiaoli.service.CollegeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author cql
 */
@Service
public class CollegeServiceImpl implements CollegeService {

    @Autowired
    private CollegeMapper collegeMapper;

    @Override
    public List<CollegeDO> collegeList() {
        return collegeMapper.selectList(null);
    }

    @Override
    public Set<String> findCollegeTestPlace(String[] ids) {
        Set<String> result = new HashSet<>();
        if (ids.length == 0) {
            return result;
        }
        List<CollegeDO> collegeDOS = collegeMapper.findCollegeTestPlace(ids);

        for (CollegeDO collegeDO : collegeDOS) {
            result.add(collegeDO.getName());
        }

        return result;
    }
}
